﻿//
// Copyright (c) 2024 BPergaofeng
//
#include <bperpush/BPerPushFactory.h>
#include "BPerPushMessageHandle.h"
BPerPushFactory::BPerPushFactory() {


}

BPerPushFactory::~BPerPushFactory() {

}

BPerPushHandle* BPerPushFactory::createPushHandle(bool hasAudio,bool initVideo,int pvideotype, BPerVideoInfo *screenvideo, BPerVideoInfo *outvideo, BPerContext *pcontext,
		BPerSysMessageI *pmessage) {
	return new BPerPushHandleImpl(hasAudio,initVideo,pvideotype,screenvideo,outvideo,pcontext, pmessage);
}

BPerSysMessageHandle* BPerPushFactory::createPushMessageHandle(bool hasAudio,bool initVideo,
		int pvideotype, BPerVideoInfo *screenvideo, BPerVideoInfo *outvideo, BPerContext *pcontext,
        BPerSysMessageI *pmessage,BPerSysMessageHandleI* pmessagehandle) {
    return new BPerPushMessageHandle(hasAudio,pvideotype,screenvideo,outvideo,pcontext, pmessage,pmessagehandle);
}

BPerVideoBuffer* BPerPushFactory::getPreVideoBuffer(BPerSysMessageHandle* pmessageHandle){
	if(!pmessageHandle) return NULL;
	BPerPushMessageHandle* mess=dynamic_cast<BPerPushMessageHandle*>(pmessageHandle);
	if(mess&&mess->m_push) return mess->m_push->getPreVideoBuffer();
	return NULL;

}

BPerSendVideoI* BPerPushFactory::getSendVideo(BPerSysMessageHandle* pmessageHandle){
	if(!pmessageHandle) return NULL;
		BPerPushMessageHandle* mess=dynamic_cast<BPerPushMessageHandle*>(pmessageHandle);
		if(mess&&mess->m_push) return mess->m_push->getSendVideo();
		return NULL;
}
